# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DisplayVideo.V3.Model.LineItemFlight do
  @moduledoc """
  Settings that control the active duration of a line item.

  ## Attributes

  *   `dateRange` (*type:* `GoogleApi.DisplayVideo.V3.Model.DateRange.t`, *default:* `nil`) - The flight start and end dates of the line item. They are resolved relative to the parent advertiser's time zone. * Required when flight_date_type is `LINE_ITEM_FLIGHT_DATE_TYPE_CUSTOM`. Output only otherwise. * When creating a new flight, both `start_date` and `end_date` must be in the future. * An existing flight with a `start_date` in the past has a mutable `end_date` but an immutable `start_date`. * `end_date` must be the `start_date` or later, both before the year 2037.
  *   `flightDateType` (*type:* `String.t`, *default:* `nil`) - Required. The type of the line item's flight dates.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dateRange => GoogleApi.DisplayVideo.V3.Model.DateRange.t() | nil,
          :flightDateType => String.t() | nil
        }

  field(:dateRange, as: GoogleApi.DisplayVideo.V3.Model.DateRange)
  field(:flightDateType)
end

defimpl Poison.Decoder, for: GoogleApi.DisplayVideo.V3.Model.LineItemFlight do
  def decode(value, options) do
    GoogleApi.DisplayVideo.V3.Model.LineItemFlight.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DisplayVideo.V3.Model.LineItemFlight do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
